package com.thrd.taiexhibition.presener;

import com.thrd.taiexhibition.bean.BeanAD;
import com.thrd.taiexhibition.bean.BeanCityList;
import com.thrd.taiexhibition.bean.BeanHomeSort;
import com.thrd.taiexhibition.callback.MvpCallback;
import com.thrd.taiexhibition.model.HomeModel;
import com.thrd.taiexhibition.view.HomeView;

import java.util.List;

/**
 * @author: ${唐杰}
 * @date: 2021/3/23
 */
public class HomePresener {
    private HomeView mHomeView;
    private HomeModel mHomeModel;

    public HomePresener(HomeView mHomeView){
        this.mHomeView=mHomeView;
        mHomeModel=new HomeModel();
    }


    public void getCityListData(){
        mHomeModel.getCityData(new MvpCallback<BeanCityList>() {
            @Override
            public void onSuccess(BeanCityList beanCityList) {
                mHomeView.onSuccess(beanCityList);
            }

            @Override
            public void onFailed(String e, int code) {
                mHomeView.onError(e, code);
            }
        });

    }

    /**
     * 分类选择
     */
    public void getClassBrowse(){
        mHomeModel.getClassBrowse(new MvpCallback<List<BeanHomeSort>>() {
            @Override
            public void onSuccess(List<BeanHomeSort> beanCityList) {
                mHomeView.onSuccess(beanCityList);
            }

            @Override
            public void onFailed(String e, int code) {
                mHomeView.onError(e, code);
            }
        });

    }


    public void getAdData(){
        mHomeModel.getAdDate(new MvpCallback<BeanAD>() {
            @Override
            public void onSuccess(BeanAD beanCityList) {
                mHomeView.onSuccess(beanCityList);
            }

            @Override
            public void onFailed(String e, int code) {
                mHomeView.onError(e, code);
            }
        });
    }

}
